<template>
  <div class="activity_cont white_box">
    <div class="activity_det_tit">一、活动对象说明</div>
    <div class="activity_det_txt">
      本次培训讲座开放对象为：{{info.TrainingTaskDepartment?.map(item =>
        item.name).join('、')}}等部门，望大家积极报名参与。
    </div>
    <div class="activity_det_tit">二、培训讲座简介：</div>
    <div class="activity_det_txt">
      {{ info.introduce }}
    </div>
    <div class="activity_det_tit">三、前置测评任务：</div>
    <div class="activity_det_txt evaluation_txt">
      本次活动开展前，请完成以下测评任务：
    </div>
    <div class="evaluation_box">
      <div class="item_evaluation" v-for="item in info.TrainingTaskRatingScaleFront" :key="item.id">
        <div class="dis_flex">
          <img :src="item.rating_scale_cover" alt="" class="evaluation_img" />
          <div class="dis_flex just_space_between flex1">
            <div>
              <div class="evaluation_txt">{{ item.rating_scale_name }}</div>
              <div class="state_show dis_flex">
                <img
                  :src="item.result_id ? require('@/assets/images/common/success_icon.png') : require('@/assets/images/common/fail_icon.png')"
                  alt="" class="evaluation_state_img" />
                <div class="evaluation_state">{{ item.result_id ? '任务已完成' : '任务未完成' }}</div>
              </div>
            </div>
            <div class="evaluation_btn" @click="toEvaluation(item)">{{ item.result_id ? '查看报告' : '去测评' }}</div>
          </div>
        </div>
      </div>
    </div>
    <div class="activity_det_tit">四、后置测评任务：</div>
    <div class="activity_det_txt evaluation_txt">
      本次活动开展前，请完成以下测评任务：
    </div>
    <div class="evaluation_box">
      <div class="item_evaluation" v-for="item in info.TrainingTaskRatingScaleAfter" :key="item.id">
        <div class="dis_flex">
          <img :src="item.rating_scale_cover" alt="" class="evaluation_img" />
          <div class="dis_flex just_space_between flex1">
            <div>
              <div class="evaluation_txt">{{ item.rating_scale_name }}</div>
              <div class="state_show dis_flex">
                <img
                  :src="item.result_id ? require('@/assets/images/common/success_icon.png') : require('@/assets/images/common/fail_icon.png')"
                  alt="" class="evaluation_state_img" />
                <div class="evaluation_state">{{ item.result_id ? '任务已完成' : '任务未完成' }}</div>
              </div>
            </div>
            <div class="evaluation_btn" @click="toEvaluation(item)">{{ item.result_id ? '查看报告' : '去测评' }}</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    info: {
      type: Object,
      default: () => { }
    }
  },
  data() {
    return {}
  },
  methods: {
    toEvaluation(item) {
      if (this.info.status !== 3 && item.type == 2) {
        return this.$toast.fail('课后测评任务需要课程结束后才可测评')
      }
      if (item.result_id > 0) {
        this.$router.push(`/lectureReport?resultId=${item.result_id}`)
      } else {
        this.$router.push(`/normalAnswer?id=${item.rating_scale_id}&type=trainingLecture&&taskType=${item.type}&taskId=${item.task_id}`);
      }
    }
  }
}
</script>

<style lang="less" scoped>
// tab为2
.dis_flex {
  display: flex;
  align-items: center;
}

.just_space_between {
  justify-content: space-between;
}

.flex1 {
  flex: 1;
}

.activity_cont {
  padding: 20px 10px;
}

.activity_det_tit {
  font-weight: bold;
  font-size: 14.67px;
  line-height: 14.67px;
}

.activity_det_txt {
  font-size: 14px;
  color: #555555;
  line-height: 29.33px;
  text-indent: 2em;
  margin: 19px 0;
}

.evaluation_txt {
  text-indent: 0;
}

.time_box {
  padding: 18px 10px;
}

.activity_time {
  // width: 150.33px;
  // height: 33.33px;
  padding: 6px 2px;
  line-height: 33.33px;
  background: linear-gradient(0deg, #ffffff 0%, rgba(255, 255, 255, 0) 100%),
    #ffffff;
  border: 0.33px solid #999999;
  border-radius: 6.67px;
  font-size: 13.33px;
  text-align: center;
}

.time_division {
  font-size: 14px;
  color: #000000;
  margin: 0 4px;
}

.activity_desc {
  color: #777777;
  font-size: 14px;
}

.item_arrange {
  margin-bottom: 24px;

  &:last-child {
    margin: 0;
  }
}

.no_data_txt {
  font-size: 10.67px;
  color: #555555;
  text-align: center;
  margin: 33px 0;
}

.footer_box {
  position: fixed;
  bottom: 0;
  left: 0;
  justify-content: space-between;
  width: 100%;
  height: 60px;
  background: #fff;
}

.footer_txt {
  font-size: 14px;
  padding-left: 20px;
}

.footer_btn {
  width: 103.33px;
  height: 59.67px;
  line-height: 59.67px;
  text-align: center;
  color: #ffffff;
  font-size: 15.33px;
  background: linear-gradient(0deg, #ffffff -20%, rgba(255, 255, 255, 0) 20%),
    #00aeff;
}

.item_evaluation {
  border-bottom: 0.67px solid #dddddd;
  padding: 16px 0;

  &:last-child {
    border: 0;
  }
}

.evaluation_img {
  width: 40px;
  height: 40.67px;
  border-radius: 6px;
  margin-right: 9.33px;
}

.evaluation_txt {
  font-size: 14px;
  line-height: 14px;
}

.state_show {
  margin-top: 7px;
}

.evaluation_state_img {
  width: 15.33px;
  height: 15.33px;
}

.evaluation_state {
  color: #000000;
  font-size: 12px;
  line-height: 12px;
  margin-left: 6px;
}

.evaluation_btn {
  width: 80px;
  height: 33.33px;
  line-height: 33.33px;
  text-align: center;
  background: linear-gradient(0deg, #ffffff -20%, rgba(255, 255, 255, 0) 20%),
    #00aeff;
  border-radius: 6.67px;
  color: #ffffff;
  font-size: 12.67px;
}
</style>